import logging, HTMLTestRunner_cn, yagmail
import unittest

from Day_2211A.Unit_09.jiuxian import jiuxian

def log():
    logging.basicConfig(level=logging.DEBUG, filename=r'C:\Users\86155\PycharmProjects\untitled\Day_2211A\Unit_09\aa.log',
                        format='%(name)s %(message)s $(asctime)s %(thread)d', filemode='a')

def bg():
    request = HTMLTestRunner_cn.HTMLTestRunner(open('./bg.html', 'wb'), title='测试报告')
    return request

def qq():
    email = yagmail.SMTP(user='3516922232@qq.com', password='sauvhzrimccccjbi', host='smtp.qq.com')
    email.send(to='3516922232@qq.com', subject='标题', contents=['aa.log', 'bg.html'])


if __name__ == '__main__':
    log()
    suite = unittest.TestSuite()
    suite.addTest(jiuxian('test_login'))
    bg().run(suite)
    qq()